// electron/controller/SystemController.ts
import SystemService from '../service/SystemService';

class SystemController {
  async getDataFromUrl(url: string) {
    if (!url || typeof url !== 'string') {
      throw new Error('无效的 URL');
    }

    try {
      const data = await SystemService.getDataFromUrl(url);
      return { success: true, data };
    } catch (error: any) {
      return {
        success: false,
        error: error.message,
        status: error.response?.status,
      };
    }
  }
}

export default new SystemController();
